// add a thing that tells you what you entered
// add basic equations for multiple variables
//"For velocity one you used: "+v1+" meters per second\nFor velocity two you used: "+v2+" meters per second\nFor time you used: "+t+" second\nFor distance you used: "+d+" meters\nFor acceleration you used: "+a+" meters per second squared"+

import javax.swing.JOptionPane;
import java.text.DecimalFormat;
import java.util.Arrays;

public class library {
        static int blankstr = 0;
        public static DecimalFormat tD = new DecimalFormat("0.000");

        // add showing the work
        public static void gravity() {
                double f = 0, m1 = 0, m2 = 0, d = 0; // initialized force, mass1, mass2,
                                                                                                // and distance
                frame.inputFrame("Gravity Problem",
                                "Leave the unknown variable blank", // prompts user for info
                                "Force in Newtons:", "First mass in kg:", "Second mass in kg:",
                                "Distance between masses in m", null,1);
                if (frame.error == false) // make sure there aren't any errors
                        return;
                if (frame.ans1.length() != 0) // specify the values
                        f = frame.Ans1;
               
                if (frame.ans2.length() != 0)
                        m1 = frame.Ans2;
                        
                if (frame.ans3.length() != 0)
                        m2 = frame.Ans3;
               
                if (frame.ans4.length() != 0)
                        d = frame.Ans4;
               

                

                double G = 6.672 * (Math.pow(10, -11));

                if (frame.ans1.length() == 0) {
                        f = (G * m1 * m2) / (d * d);
                        JOptionPane
                                        .showMessageDialog(
                                                        null,
                                                        "The answer you are looking for is "
                                                                        + tD.format(f)
                                                                        + "\nTo solve for Force you can use the equation F=(G*m1*m2)/d^2\nThe work is "
                                                                        + tD.format(f) + "=(G*" + tD.format(m1)
                                                                        + "*" + tD.format(m2) + ")/" + tD.format(d)
                                                                        + "^2\nG=6.672*10^-11");
                }

                if (frame.ans2.length() == 0) {
                        m1 = (d * d * f) / (G * m2);
                        JOptionPane
                                        .showMessageDialog(
                                                        null,
                                                        "The answer you are looking for is "
                                                                        + tD.format(m1)
                                                                        + "\nTo solve for Mass 1 you can use the equation m1=(d^2*F)/(G*m2)\nThe work is "
                                                                        + tD.format(m1) + "=(" + tD.format(d)
                                                                        + "^2*" + tD.format(f) + ")/(G*" + m2
                                                                        + ")\nG=6.672*10^-11");
                }

                if (frame.ans3.length() == 0) {
                        m2 = (d * d * f) / (G * m1);
                        JOptionPane
                                        .showMessageDialog(
                                                        null,
                                                        "The answer you are looking for is "
                                                                        + tD.format(m2)
                                                                        + "\nTo solve for Mass 2 you can use the equation m2=(d^2*F)/(G*m2)\nThe work is "
                                                                        + tD.format(m2) + "=(" + tD.format(d)
                                                                        + "^2*" + tD.format(f) + ")/(G*"
                                                                        + tD.format(m2) + ")\nG=6.672*10^-11");
                }

                if (frame.ans4.length() == 0) {
                        d = Math.sqrt((G * m1 * m2) / f);
                        JOptionPane
                                        .showMessageDialog(
                                                        null,
                                                        "The answer you are looking for is "
                                                                        + tD.format(d)
                                                                        + "\nTo solve for Distance you can use the equation d=(Ã((G*m1*m2)/f)\nThe work is "
                                                                        + tD.format(d) + "=(Ã((G*" + tD.format(m1)
                                                                        + "*" + tD.format(m2) + ")/" + tD.format(f)
                                                                        + ")\nG=6.672*10^-11");
                }

        }

        //
        //
        //
        //
        //
        //
        // next type of equations
        //
        //
        //
        //
        //
        //

        public static void basic() {
                double v1 = 0, v2 = 0, a = 0, d = 0, t = 0;
                frame.inputFrame("Basic Equations",
                                "Please leave the 2 unknown variables blank.",
                                "Starting velocity in m/s:", "Ending velocity in m/s:",
                                "Time elapsed in s:", "Distance traveled in m:",
                                "Net acceleration in m/s^2",2);
                if (frame.error == false)
                        return;
                if (frame.ans1.length() != 0) // specify the values
                        v1 = frame.Ans1;
              
                if (frame.ans2.length() != 0)
                        v2 = frame.Ans2;
             
                if (frame.ans3.length() != 0)
                        t = frame.Ans3;
              
                if (frame.ans4.length() != 0)
                        d = frame.Ans4;

                if (frame.ans5.length() != 0)
                        a = frame.Ans5;
                

                if (frame.ans4.length() == 0) { // distance

                        if (frame.ans2.length() == 0) { // velocity 2
                                v2 = v1 + (a * t);
                                JOptionPane
                                                .showMessageDialog(
                                                                null,
                                                                "For velocity one you used: "
                                                                                + tD.format(v1)
                                                                                + " meters per second\nFor time you used: "
                                                                                + tD.format(t)
                                                                                + " seconds\nFor acceleration you used: "
                                                                                + tD.format(a)
                                                                                + " meters per second squared\n\nThe answer you are looking for is "
                                                                                + tD.format(v2)
                                                                                + " meters per second.\nTo solve for Velocity 2 you can use the equation v2=v1+(a*t)\nThe work is "
                                                                                + tD.format(v2) + "=" + tD.format(v1)
                                                                                + "(" + tD.format(a) + "*"
                                                                                + tD.format(t) + ")");
                        }
                        // //

                        if (frame.ans1.length() == 0) { // velocity 1
                                v1 = v2 - (a * t);
                                JOptionPane
                                                .showMessageDialog(
                                                                null,
                                                                "For velocity two you used: "
                                                                                + tD.format(v2)
                                                                                + " meters per second\nFor time you used: "
                                                                                + tD.format(t)
                                                                                + " second\nFor acceleration you used: "
                                                                                + tD.format(a)
                                                                                + " meters per second squared\n\nThe answer you are looking for is "
                                                                                + tD.format(v1)
                                                                                + " meters per second.\nTo solve for Velocity 1 you can use the equation v1=v2-(a*t)\nThe work is "
                                                                                + tD.format(v1) + "=" + tD.format(v2)
                                                                                + "-" + "(" + tD.format(a) + "*"
                                                                                + tD.format(t) + ")");
                        }
                        // //

                        if (frame.ans5.length() == 0) { // acceleration
                                a = (v1 - v2) / t;
                                JOptionPane
                                                .showMessageDialog(
                                                                null,
                                                                "For velocity one you used: "
                                                                                + tD.format(v1)
                                                                                + " meters per second\nFor velocity two you used: "
                                                                                + tD.format(v2)
                                                                                + " meters per second\nFor time you used: "
                                                                                + tD.format(t)
                                                                                + " second"
                                                                                + "\n\nThe answer you are looking for is "
                                                                                + tD.format(a)
                                                                                + " meters per second squared.\nTo solve for Acceleration you can use the equation a=(v1-v2)/t\nThe work is "
                                                                                + tD.format(a) + "=(" + tD.format(v1)
                                                                                + "-" + tD.format(v2) + ")/"
                                                                                + tD.format(t));
                        }
                        // //

                        if (frame.ans3.length() == 0) { // time
                                t = (v1 - v2) / a;
                                JOptionPane
                                                .showMessageDialog(
                                                                null,
                                                                "For velocity one you used: "
                                                                                + tD.format(v1)
                                                                                + " meters per second\nFor velocity two you used: "
                                                                                + tD.format(v2)
                                                                                + " meters per second\nFor acceleration you used: "
                                                                                + tD.format(a)
                                                                                + " meters per second squared"
                                                                                + "\n\nThe answer you are looking for is "
                                                                                + tD.format(t)
                                                                                + " seconds.\nTo solve for Time can you use the equation t=(v1-v2)/a\nThe work is "
                                                                                + tD.format(t) + "=(" + tD.format(v1)
                                                                                + "-" + tD.format(v2) + ")/"
                                                                                + tD.format(a));
                        }
                }
                //
                //
                //
                // next set of equations here
                //
                //
                //
                if (frame.ans5.length() == 0) { // acceleration

                        if (frame.ans4.length() == 0) { // distance
                                d = .5 * (v1 + v2) * t;
                                JOptionPane
                                                .showMessageDialog(
                                                                null,
                                                                "For velocity one you used: "
                                                                                + tD.format(v1)
                                                                                + " meters per second\nFor velocity two you used: "
                                                                                + tD.format(v2)
                                                                                + " meters per second\nFor time you used: "
                                                                                + tD.format(t)
                                                                                + " second\n\nThe answer you are looking for is "
                                                                                + tD.format(d)
                                                                                + " meters.\nTo solve for Distance you can use the equation d=.5(v1+v2)*t\nThe work is "
                                                                                + tD.format(d) + "=.5(" + tD.format(v1)
                                                                                + "+" + tD.format(v2) + ")*"
                                                                                + tD.format(t));
                        }
                        // //

                        if (frame.ans3.length() == 0) { // time
                                t = 2 * d / (v1 + v2);
                                JOptionPane
                                                .showMessageDialog(
                                                                null,
                                                                "For velocity one you used: "
                                                                                + tD.format(v1)
                                                                                + " meters per second\nFor velocity two you used: "
                                                                                + tD.format(v2)
                                                                                + " meters per second\nFor distance you used: "
                                                                                + tD.format(d)
                                                                                + " meters\n\nThe answer you are looking for is "
                                                                                + tD.format(t)
                                                                                + " seconds.\nTo solve for Time you can use the equation t=2*d/(v1+v2)\nThe work is "
                                                                                + tD.format(t) + "=2*" + tD.format(d)
                                                                                + "/(" + tD.format(v1) + "+"
                                                                                + tD.format(v2) + ")");
                        }
                        // //

                        if (frame.ans1.length() == 0) { // velocity
                                v1 = ((2 * d) / t) - v2;
                                JOptionPane
                                                .showMessageDialog(
                                                                null,
                                                                "For velocity two you used: "
                                                                                + tD.format(v2)
                                                                                + " meters per second\nFor time you used: "
                                                                                + tD.format(t)
                                                                                + " second\nFor distance you used: "
                                                                                + tD.format(d)
                                                                                + " meters\n\nThe answer you are looking for is "
                                                                                + tD.format(v1)
                                                                                + " meters per second.\nTo solve for Velocity 1 you can use the equation v1=((2*d)/t)-v2\nThe work is "
                                                                                + tD.format(v1) + "=((2*"
                                                                                + tD.format(d) + ")/" + tD.format(t)
                                                                                + ")-" + tD.format(v2));
                        }
                        // //

                        if (frame.ans2.length() == 0) { // velocity 2
                                v2 = ((2 * d) / t) - v1;
                                JOptionPane
                                                .showMessageDialog(
                                                                null,
                                                                "For velocity one you used: "
                                                                                + tD.format(v1)
                                                                                + " meters per second\nFor time you used: "
                                                                                + tD.format(t)
                                                                                + " second\nFor distance you used: "
                                                                                + tD.format(d)
                                                                                + " meters\n\nThe answer you are looking for is "
                                                                                + tD.format(v2)
                                                                                + " meters per second.\nTo solve for Velocity 2 you can use the equation v2=((2*d)-v1)-t\nThe work is "
                                                                                + tD.format(v2) + "=((2*"
                                                                                + tD.format(d) + ")-" + tD.format(v1)
                                                                                + ")-" + tD.format(t));
                        }
                }
                //
                //
                //
                // next set of equations
                //
                //
                //
                //
                if (frame.ans3.length() == 0) { // time

                        if (frame.ans2.length() == 0) { // velocity 2
                                v2 = Math.sqrt((v1 * v1) + 2 * a * d);
                                JOptionPane
                                                .showMessageDialog(
                                                                null,
                                                                "For velocity one you used: "
                                                                                + tD.format(v1)
                                                                                + " meters per second\nFor distance you used: "
                                                                                + tD.format(d)
                                                                                + " meters\nFor acceleration you used: "
                                                                                + tD.format(a)
                                                                                + " meters per second squared\n\nThe answer you are looking for is "
                                                                                + tD.format(v2)
                                                                                + " meters per second.\nTo solve for Velocity 2 you can use the equation v2=Ã[v1^2+(2*a*d)]\nThe work is "
                                                                                + tD.format(v2) + "=Ã[" + tD.format(v1)
                                                                                + "^2+(2*" + tD.format(a) + "*"
                                                                                + tD.format(d) + ")]");
                        }

                        if (frame.ans1.length() == 0) { // velocity 1
                                v1 = Math.sqrt((v2 * v2) + 2 * a * d);
                                JOptionPane
                                                .showMessageDialog(
                                                                null,
                                                                "For velocity two you used: "
                                                                                + tD.format(v2)
                                                                                + " meters per second\nFor distance you used: "
                                                                                + tD.format(d)
                                                                                + " meters\nFor acceleration you used: "
                                                                                + tD.format(a)
                                                                                + " meters per second squared\n\nThe answer you are looking for is "
                                                                                + tD.format(v1)
                                                                                + " meters per second.\nTo solve for Velocity 1 you can use the equation v1=Ã[v2^2+(2*a*d)]\nThe work is "
                                                                                + tD.format(v1) + "=Ã[" + tD.format(v2)
                                                                                + "^2+(2*" + tD.format(a) + "*"
                                                                                + tD.format(d) + ")]");
                        }

                        if (frame.ans4.length() == 0) { // distance
                                d = ((v1 * v1) - (v2 * v2)) / (2 * a);
                                JOptionPane
                                                .showMessageDialog(
                                                                null,
                                                                "For velocity one you used: "
                                                                                + tD.format(v1)
                                                                                + " meters per second\nFor velocity two you used: "
                                                                                + tD.format(v2)
                                                                                + " meters per second\nFor acceleration you used: "
                                                                                + tD.format(a)
                                                                                + " meters per second squared\n\nThe answer you are looking for is "
                                                                                + tD.format(d)
                                                                                + " meters.\nTo solve for Distance you can use the equation d=(v1^2-v2^2)/2a\nThe work is "
                                                                                + tD.format(d) + "=(" + tD.format(v1)
                                                                                + "^2-" + tD.format(v2) + "^2)/2"
                                                                                + tD.format(a));
                        }

                        if (frame.ans5.length() == 0) { // acceleration
                                a = ((v2 * v2) - (v1 * v1)) / (2 * d);
                                JOptionPane
                                                .showMessageDialog(
                                                                null,
                                                                "For velocity one you used: "
                                                                                + tD.format(v1)
                                                                                + " meters per second\nFor velocity two you used: "
                                                                                + tD.format(v2)
                                                                                + " meters per second\nFor distance you used: "
                                                                                + tD.format(d)
                                                                                + " meters"
                                                                                + "\n\nThe answer you are looking for is "
                                                                                + tD.format(a)
                                                                                + " meters per second squared.\nTo solve for Acceleration you can use the equation a=(z1^2-v1^2)/2a\nThe work is "
                                                                                + tD.format(a) + "=(" + tD.format(v1)
                                                                                + "^2-" + tD.format(v1) + "^2)/2"
                                                                                + tD.format(a));
                        }

                }
                //
                //
                //
                // next set of equations
                //
                //
                //
                //

                if (frame.ans2.length() == 0) { // velocity 2

                        if (frame.ans4.length() == 0) { // distance
                                d = v1 * t + (a * t * t) / 2;
                                JOptionPane
                                                .showMessageDialog(
                                                                null,
                                                                "For velocity one you used: "
                                                                                + tD.format(v1)
                                                                                + " meters per second\nFor time you used: "
                                                                                + tD.format(t)
                                                                                + " second\nFor acceleration you used: "
                                                                                + tD.format(a)
                                                                                + " meters per second squared"
                                                                                + "\n\nThe answer you are looking for is "
                                                                                + tD.format(d)
                                                                                + " meters.\nTo solve for Distance you can use the equation d=v1*t+(a*t^2)/2\nThe work is "
                                                                                + tD.format(d) + "=" + tD.format(v1)
                                                                                + "*" + tD.format(t) + "+("
                                                                                + tD.format(a) + "*" + tD.format(t)
                                                                                + "^2)/2");
                        }

                        if (frame.ans1.length() == 0) { // velocity 1
                                v1 = (d / t) - (.5 * a * t);
                                JOptionPane
                                                .showMessageDialog(
                                                                null,
                                                                "For time you used: "
                                                                                + tD.format(t)
                                                                                + " second\nFor distance you used: "
                                                                                + tD.format(d)
                                                                                + " meters\nFor acceleration you used: "
                                                                                + tD.format(a)
                                                                                + " meters per second squared"
                                                                                + "\n\nThe answer you are looking for is "
                                                                                + tD.format(v1)
                                                                                + " meters per second.\nTo solve for Velocity 1 you can use the equation v1=(d/t)-(.5*a*t)\nThe work is "
                                                                                + tD.format(v1) + "=(" + tD.format(d)
                                                                                + "/" + tD.format(t) + ")-(.5*"
                                                                                + tD.format(a) + "*" + tD.format(t)
                                                                                + ")");
                        }

                        if (frame.ans5.length() == 0) { // acceleration
                                a = (2 * (d - (v1 * t))) / (t * t);
                                JOptionPane
                                                .showMessageDialog(
                                                                null,
                                                                "For velocity one you used: "
                                                                                + tD.format(v1)
                                                                                + " meters per second\nFor time you used: "
                                                                                + tD.format(t)
                                                                                + " second\nFor distance you used: "
                                                                                + tD.format(d)
                                                                                + " meters"
                                                                                + "\n\nThe answer you are looking for is "
                                                                                + tD.format(a)
                                                                                + " meters per second squared.\nTo solve for Acceleration you can use the equation 2*(d-v1*t)/t^2\nThe work is 2*("
                                                                                + tD.format(d) + "-" + tD.format(v1)
                                                                                + "*" + tD.format(t) + ")/"
                                                                                + tD.format(t) + "^2");
                        }

                        if (frame.ans3.length() == 0) { // time
                                t = (-2 * v1 + Math.sqrt((Math.pow(v1, 2)) + (8 * a * d))) / 2;
                                double t2 = (-2 * v1 - Math.sqrt((Math.pow(v1, 2))
                                                + (8 * a * d))) / 2;
                                JOptionPane
                                                .showMessageDialog(
                                                                null,
                                                                "For velocity one you used: "
                                                                                + tD.format(v1)
                                                                                + " meters per second\nFor distance you used: "
                                                                                + tD.format(d)
                                                                                + " meters\nFor acceleration you used: "
                                                                                + tD.format(a)
                                                                                + " meters per second squared"
                                                                                + "\n\nThere are two possible answers for time. They are "
                                                                                + tD.format(t)
                                                                                + " seconds or "
                                                                                + tD.format(t2)
                                                                                + " seconds.\nTo solve for Time you can use the equation t=(-2*v1 +/- Ã(v1^2+8*a*d))/2\nThe work is "
                                                                                + tD.format(t) + "=(-2*"
                                                                                + tD.format(v1) + " +/- Ã("
                                                                                + tD.format(v1) + "^2+8*"
                                                                                + tD.format(a) + "*" + tD.format(d)
                                                                                + "))/2");
                        }
                }

                //
                //
                //
                // next set of equations
                //
                //
                //
                //

                if (frame.ans1.length() == 0) { // velocity 1

                        if (frame.ans4.length() == 0) {// does not work //distance
                                d = v2 * t + (a * t * t) / 2;
                                JOptionPane
                                                .showMessageDialog(
                                                                null,
                                                                "For velocity two you used: "
                                                                                + tD.format(v2)
                                                                                + " meters per second\nFor time you used: "
                                                                                + tD.format(t)
                                                                                + " second\nFor acceleration you used: "
                                                                                + tD.format(a)
                                                                                + " meters per second squared"
                                                                                + "\n\nThe answer you are looking for is "
                                                                                + tD.format(d)
                                                                                + " meters.\nTo solve for Distance you can use the equation d=v2*t+(a*t^2)/2\nThe work is "
                                                                                + tD.format(d) + "=" + tD.format(v2)
                                                                                + "*" + tD.format(t) + "+("
                                                                                + tD.format(a) + "*" + tD.format(t)
                                                                                + "^2)/2");
                        }

                        if (frame.ans2.length() == 0) { // velocity 2
                                v2 = (d / t) - (.5 * a * t);
                                JOptionPane
                                                .showMessageDialog(
                                                                null,
                                                                "For time you used: "
                                                                                + tD.format(t)
                                                                                + " second\nFor distance you used: "
                                                                                + tD.format(d)
                                                                                + " meters\nFor acceleration you used: "
                                                                                + tD.format(a)
                                                                                + " meters per second squared"
                                                                                + "\n\nThe answer you are looking for is "
                                                                                + tD.format(v2)
                                                                                + " meters per second.\nTo solve for Velocity 2 you can use the equation v2=(d/t)-(.5*a*t)\nThe work is "
                                                                                + tD.format(v2) + "=(" + tD.format(d)
                                                                                + "/" + tD.format(t) + ")-(.5*"
                                                                                + tD.format(a) + "*" + tD.format(t)
                                                                                + ")");
                        }

                        if (frame.ans5.length() == 0) { // acceleration
                                a = (2 * (d - (v2 * t))) / (t * t);
                                JOptionPane
                                                .showMessageDialog(
                                                                null,
                                                                "For velocity two you used: "
                                                                                + tD.format(v2)
                                                                                + " meters per second\nFor time you used: "
                                                                                + tD.format(t)
                                                                                + " second\nFor distance you used: "
                                                                                + tD.format(d)
                                                                                + " meters\n\nThe answer you are looking for is "
                                                                                + tD.format(a)
                                                                                + " meters per second squared.\nTo solve for Acceleration you can use the equation 2*(d-v2*t)/t^2\nThe work is 2*("
                                                                                + tD.format(d) + "-" + tD.format(v2)
                                                                                + "*" + tD.format(t) + ")/"
                                                                                + tD.format(t) + "^2");
                        }

                        if (frame.ans3.length() == 0) { // time
                                t = (-2 * v2 + Math.sqrt((Math.pow(v2, 2)) + (8 * a * d))) / 2;
                                double t2 = (-2 * v2 - Math.sqrt((Math.pow(v2, 2))
                                                + (8 * a * d))) / 2;
                                JOptionPane
                                                .showMessageDialog(
                                                                null,
                                                                "For velocity two you used: "
                                                                                + tD.format(v2)
                                                                                + " meters per second\nFor distance you used: "
                                                                                + tD.format(d)
                                                                                + " meters\nFor acceleration you used: "
                                                                                + tD.format(a)
                                                                                + " meters per second squared"
                                                                                + "\n\nThere are two possible answers for time. They are "
                                                                                + tD.format(t)
                                                                                + " seconds or "
                                                                                + tD.format(t2)
                                                                                + " seconds.\nTo solve for Time you can use the equation t=(-2*v2 +/- Ã(v1^2+8*a*d))/2\nThe work is "
                                                                                + tD.format(t) + "=(-2*"
                                                                                + tD.format(v2) + " +/- Ã("
                                                                                + tD.format(v2) + "^2+8*"
                                                                                + tD.format(a) + "*" + tD.format(d)
                                                                                + "))/2");
                        }
                }

        }

        //
        //
        //
        //
        //
        //
        // next type of equations
        //
        //
        //
        //
        //
        //

        public static void satellite_distance() {
                double v = 0, d = 0, m = 0, G = 6.672 * (Math.pow(10, -11));
                frame.inputFrame("Satellite Equations",
                                "Please leave the unknown variable blank.", "Velocity in m/s:",
                                "Distance between objects in m:", "Mass of satellite in kg:",
                                null, null,1);
                if (frame.error == false)
                        return;
                if (frame.ans1.length() != 0) // specify the values
                        v = frame.Ans1;
                
                if (frame.ans2.length() != 0)
                        d = frame.Ans2;
                
                if (frame.ans3.length() != 0)
                        m = frame.Ans3;
               
                

                if (frame.ans1.length() == 0) {
                        v = Math.sqrt((G * m) / d);
                        JOptionPane
                                        .showMessageDialog(
                                                        null,
                                                        "For distance you used "
                                                                        + tD.format(d)
                                                                        + " meters\nFor mass you used "
                                                                        + tD.format(m)
                                                                        + " kilograms\nThe velocity is "
                                                                        + tD.format(v)
                                                                        + " meters per second\nYou can use the equation v=Ã((G*m)/d)\nG="
                                                                        + G);
                }

                else if (frame.ans2.length() == 0) {
                        d = (G * m) / (v * v);
                        JOptionPane
                                        .showMessageDialog(
                                                        null,
                                                        "For velocity you used "
                                                                        + tD.format(v)
                                                                        + " meters per second\nFor mass you used "
                                                                        + tD.format(m)
                                                                        + " kilograms\nThe distance between the satelite and the center is "
                                                                        + tD.format(d)
                                                                        + " meters\nYou can use the equation G*m/v^2\nG="
                                                                        + G);
                }

                else if (frame.ans3.length() == 0) {
                        m = (v * v * d) / G;
                        JOptionPane
                                        .showMessageDialog(
                                                        null,
                                                        "For velocity you used "
                                                                        + tD.format(v)
                                                                        + "The mass of the satelite is "
                                                                        + tD.format(m)
                                                                        + " kilometers\nYou can use the equation m=(v^2*d)/G\nG="
                                                                        + G);
                }
        }

        //
        //
        //
        //
        //
        //
        // next type of equations
        //
        //
        //
        //
        //
        //

        public static void laws() {
                String[] laws = { "Newton's laws", "Mass Energy laws", "Momentum" };
                int law = JOptionPane.showOptionDialog(null,
                                "What law do you want to review?", "Laws",
                                JOptionPane.YES_NO_OPTION, JOptionPane.PLAIN_MESSAGE, null,
                                laws, laws[0]);
                if (law == 0) {
                        JOptionPane
                                        .showMessageDialog(
                                                        null,
                                                        "Newton has three laws of motion:\n1.) An object in motion will stay in motion unless an external force is aplied.\n2.) The relationship between Force (F), mass (m) and acceleration (a) is F=ma.\n3.) For every action there is an equal and opposite reaction.");
                }
                if (law == 1) {
                        JOptionPane
                                        .showMessageDialog(
                                                        null,
                                                        "All matter and energy must be conserved.\nThe mass in a closed system must be the same from the beginning to the end.\nThe energy must be the same from the beginning to the end.");
                }
                if (law == 2) {
                        JOptionPane
                                        .showMessageDialog(
                                                        null,
                                                        "All momentum must be conserved.\nAll the momentums in a closed circut must be balanced.\nThe initial momentum must be the same as the final momentum.");
                }

        }

        //
        //
        //
        //
        //
        //
        // next type of equations
        //
        //
        //
        //
        //
        //

        public static void ricochet() {
                // [what mass it pertains to] [angle or velocity] [given or unknown]
                // [radians or degrees]

                frame.inputFrame("Frictionless Ricochet Equation",
                                "Input the following information. Leave nothing blank.",
                                "Mass of first object in kg:",
                                "Velocity of first object before collision in m/s:",
                                "Mass of second object in kg:",
                                "Velocity of second object after collision in m/s:",
                                "Angle of travel of second object after collision:");
                
                if (frame.error == false)
                        return;

                double m1 = frame.Ans1;
                double v1i = frame.Ans2;
                double m2 = frame.Ans3;
                double m2a = frame.Ans4;
                double v2 = frame.Ans5;

                double m2agrad = m2a * (Math.PI / 180);

                double yv1 = v2 * Math.sin(m2agrad);
                double m2aurad = (.5 * Math.PI) - m2agrad;
                double xv1 = v2 * Math.sin(m2aurad);

                double xv2 = ((m1 * v1i) - (xv1 * m2)) / m1;
                double yv2 = (yv1 * m2) / m1;

                double hv = Math.sqrt((xv2 * xv2) + (yv2 * yv2));// final answer for
                                                                                                                        // velocity of q
                                                                                                                        // ball wrong need
                                                                                                                        // to solve for the
                                                                                                                        // momentum then
                                                                                                                        // divide by mass
                double m1aurad = Math.asin(yv2 / hv);
                double m1aud = m1aurad * (180 / Math.PI); // final answer for the angle
                                                                                                        // of q ball

                JOptionPane
                                .showMessageDialog(
                                                null,
                                                "For the first mass you put in "
                                                                + tD.format(m1)
                                                                + " kilograms.\nFor the initial velocity for the first mass you used "
                                                                + v1i
                                                                + " meters per second.\nFor the second mass you used "
                                                                + tD.format(m2)
                                                                + " kilograms.\nFor the angle of the second mass after the collision you used "
                                                                + tD.format(m2a)
                                                                + " degrees.\nFor the velocity of the second mass after the collision you used "
                                                                + tD.format(v2) + " meters per second");
                JOptionPane
                                .showMessageDialog(
                                                null,
                                                "The equations for the first triangle are as follows:\nVelocity of mass 2 * sin(angle of mass 2) = vertical velocity\n90-angle of mass 2 = unknown angle\nVelocity of mass 2 * sin(unknown angle) = horizontal distance \n\n"
                                                                + tD.format(v2)
                                                                + "*sin("
                                                                + tD.format(m2a)
                                                                + ")=vertical velocity\n90-"
                                                                + tD.format(m2a)
                                                                + "=unknown angle\n"
                                                                + tD.format(v2)
                                                                + "*sin("
                                                                + tD.format(m2aurad) + ")=horizontal velocity");// finish
                                                                                                                                                                // this
                                                                                                                                                                // up
                JOptionPane
                                .showMessageDialog(
                                                null,
                                                "The equations for the second triangle are as follows:\n((mass 1 * velocity of mass 1) - (mass 2 * horizontal velocity of mass 2)) / mass 1 = horizontal velocity of mass 1 after the collision\nVertical momentum of mass 2 / mass 1 = vertical velocity of mass 1\nÃ((horzontal velocity of mass 2) ^2) + ((vertical velocity of mass 2)^2))\nArcsin(horizontal velocity of mass 1 / final velocity of mass 1 = angle of mass 1\n\n(("
                                                                + tD.format(m1)
                                                                + "*"
                                                                + tD.format(v1i)
                                                                + ")-("
                                                                + tD.format(m2)
                                                                + "*"
                                                                + tD.format(yv1)
                                                                + ") / "
                                                                + tD.format(m1)
                                                                + "="
                                                                + tD.format(xv2)
                                                                + "\n"
                                                                + tD.format(yv1 * m2)
                                                                + "/"
                                                                + tD.format(m1)
                                                                + "="
                                                                + tD.format(yv2)
                                                                + "Ã("
                                                                + tD.format(xv2 * xv2)
                                                                + "+"
                                                                + tD.format(yv2 * yv2) + ")");
                JOptionPane
                                .showMessageDialog(
                                                null,
                                                "The final velocity for the first mass is "
                                                                + tD.format(hv)
                                                                + " meters per second.\nThe angle of the first mass is "
                                                                + tD.format(m1aud) + " degrees");

        }
        
        
        public static void projoctiles() {
    		String[] projecs = { "Symmetrical", "Asymmetrical", "Horizontal" };
    		int projecDecide = JOptionPane.showOptionDialog(null,
    				"Which projectile equation would you like help with?",
    				"Projectile equations", JOptionPane.YES_NO_OPTION,
    				JOptionPane.PLAIN_MESSAGE, null, projecs, projecs[0]);// should
    																		// this
    																		// be a
    																		// JFrame?

    		if (projecDecide == 0) {
    			frame.inputFrame("Symmetrical Projectiles",
    					"Input the following information. Leave nothing blank.",
    					"What is the initial velocity of the projectile in m/s",
    					"What is the angle of the projectile in degrees", null,
    					null, null);
    			double aideg = Double.parseDouble(frame.ans1); // angle measure in
    															// degrees
    			double vihyp = Double.parseDouble(frame.ans2); // velocity along the
    															// hypotonuse

    			double airad = aideg * (Math.PI / 180);// given angle in radians
    			double aurad = Math.PI - airad;// unknown angle in radians
    			double vvert = vihyp * Math.sin(airad);// vertical velocity
    													// component
    			double vhorz = vihyp * Math.sin(aurad);// horizontal velocity
    													// component
    			// vertical part
    			double time = (2 * vvert) / 9.8;// the time spent in the air
    			// horizontal part
    			double distance = vhorz * time;// the distance traveled horizontally
    			// extra
    			double mxht = 4.9 * time * time;// the maximum height

    			JOptionPane
    					.showMessageDialog(
    							null,
    							"The first angle you used was "
    									+ tD.format(aideg)
    									+ " degrees.\nThe velocity of the projectile was "
    									+ tD.format(vihyp)
    									+ " m/s.\n\nThe horizontal velocity is "
    									+ tD.format(vhorz)
    									+ " m/s.\nThe vertical velocity at the beginning is "
    									+ tD.format(vvert)
    									+ " m/s.\nThe time the projectile was in the air was "
    									+ tD.format(time)
    									+ " s.\nThe distance that the projectile traveled was "
    									+ distance + "m.\nThe maximum height was "
    									+ mxht + "m");// finish showing work and
    													// answers
    			JOptionPane
    					.showMessageDialog(
    							null,
    							"The work is:\n90-known angle= unknown angle\nLaunch velocity*sin(known angle)= vertical velocity\nLaunch velocity*sin(unknown angle)= horizontal velocity\nVertical velocity/4.9= time in the air\nHorizontal velocity*time= distance traveled\n4.9*time^2= maximum height\n\n90-"
    									+ aideg);// show the work with numbers

    		}
    	}

    	//momentum equations
    	
    	public static void momentum(){
    		
    		double MBefore[] = new double[25];// masses of the mass before the collision
		Arrays.fill(MBefore, (Integer) null);//sets the masses to null
    		double VBefore[] = new double[25];//velocities that correspond to the masses before collision
    		Arrays.fill(VBefore, (Integer) null);//sets velocities to null
    		double MAfter[] = new double[25];
    		Arrays.fill(MAfter, (Integer) null);//sets second masses to null
    		double VAfter[] = new double[25];//velocities that correspond to the masses before collision
    		Arrays.fill(VAfter, (Integer) null);//sets velocities after collision to null

    		for(int i=0; i<25; i++){
    			
    		}
    		
    	}


        
}

